package com.ruoyi.warning.service.impl;

import com.aliyun.tea.TeaException;

public class Robot {

    /**
     * 使用 Token 初始化账号Client
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.dingtalkrobot_1_0.Client createClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config();
        config.protocol = "https";
        config.regionId = "central";
        return new com.aliyun.dingtalkrobot_1_0.Client(config);
    }

    public static void main(String[] args_) throws Exception {
        java.util.List<String> args = java.util.Arrays.asList(args_);
        com.aliyun.dingtalkrobot_1_0.Client client = Robot.createClient();
        com.aliyun.dingtalkrobot_1_0.models.RobotSendDingHeaders robotSendDingHeaders = new com.aliyun.dingtalkrobot_1_0.models.RobotSendDingHeaders();
        robotSendDingHeaders.xAcsDingtalkAccessToken = "347ddd7f126a34c6808701bd87feafc0";
        com.aliyun.dingtalkrobot_1_0.models.RobotSendDingRequest robotSendDingRequest = new com.aliyun.dingtalkrobot_1_0.models.RobotSendDingRequest()
                .setRobotCode("dingwzsuuwkhxmzp6cnu")
                .setRemindType(1)
                .setReceiverUserIdList(java.util.Arrays.asList(
                        "manager6282"
                ))
                .setContent("温控报警测试");
        try {
            client.robotSendDingWithOptions(robotSendDingRequest, robotSendDingHeaders, new com.aliyun.teautil.models.RuntimeOptions());
            System.out.println("wanshi");
        } catch (TeaException err) {
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err 中含有 code 和 message 属性，可帮助开发定位问题
                System.out.println(err.message);
            }

        } catch (Exception _err) {
            TeaException err = new TeaException(_err.getMessage(), _err);
            if (!com.aliyun.teautil.Common.empty(err.code) && !com.aliyun.teautil.Common.empty(err.message)) {
                // err 中含有 code 和 message 属性，可帮助开发定位问题
                System.out.println(err.message);
            }

        }
    }
}
